//
//  SelectedFaFangZiYuanAlertViewHeader.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/25.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "SelectedFaFangZiYuanAlertViewHeader.h"

@implementation SelectedFaFangZiYuanAlertViewHeader

- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
        [self layout];
    }
    return self;
}
- (void)initSubView{
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.leftImageView];
    [self addSubview:self.nameLabel];
    [self addSubview:self.detailLabel];
}
- (void)layout{
    [_leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.centerY.equalTo(self.mas_centerY);
        make.width.equalTo(@26);
        make.height.equalTo(@23);
    }];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self->_leftImageView.mas_right).offset(10);
        make.centerY.equalTo(self->_leftImageView.mas_centerY);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@15);
    }];
    
    [_detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-10);
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.mas_centerX);
        make.height.equalTo(@23);
    }];
}
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"标题";
        label.textColor = SELECTEDCOLOR;
        label.textAlignment = 0;
        label.font = [UIFont systemFontOfSize:14];
        _nameLabel = label;
    }
    return _nameLabel;
}

- (UIImageView *)leftImageView{
    if (!_leftImageView ) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.image = [UIImage imageNamed:@"zy_collection_xjwjj"];
        _leftImageView  = imageView;
    }
    return _leftImageView;
}

- (UILabel *)detailLabel{
    if (!_detailLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"文件：3  大小：82.5MB";
        label.textColor = TITLECOLOR;
        label.textAlignment = 2;
        label.font = [UIFont systemFontOfSize:12];
        _detailLabel = label;
    }
    return _detailLabel;
}
- (void)drawRect:(CGRect)rect{
    UIBezierPath *path = [[UIBezierPath alloc]init];
    [path moveToPoint:CGPointMake(502, 43)];
    [path addLineToPoint:CGPointMake(0, 43)];
    [LINCOLOR set];
    [path stroke];
}
@end
